<?php
/**
 * Created by PhpStorm.
 * User: wumengmeng <wu_mengmeng@foxmail.com>
 * Date: 2019/4/26 0026
 * Time: 14:35
 */

namespace HiCommon\Service;

use HiCommon\Repository\AreasRepository;

class AreasService extends BaseService
{

    /**
     * 根据cityids查询城市和区域
     *
     * @param $arr_cityids
     *
     * @return array
     * @author wumengmeng <wu_mengmeng@foxmail.com>
     */
    public function api_city_area_by_cityids($arr_cityids){
        $data = AreasRepository::get_city_area_by_cityids($arr_cityids)->toArray();
        return  hello_success('成功',$data);
    }

    public function api_province_and_city(){
        $arr_option = [
          'where'=>['level'=>1],
          'with'=>['son'],
          'field'=>['id','name'],
          'order'=>['key'=>'id','value'=>'asc'],
        ];
        $data = AreasRepository::base_get_all($arr_option)->toArray();
        return  hello_success('成功',$data);
    }
}